<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page import="java.util.List,java.util.Map;" %>
<%@ taglib uri="/WEB-INF/c.tld" prefix="c" %> 
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<link rel="stylesheet" href="<%=request.getContextPath()%>/public/css/style.model.css">
<link rel="stylesheet" href="<%=request.getContextPath()%>/public/css/style.wf.css">
<!-- core -->
<script src="<%=request.getContextPath()%>/public/js/jquery-1.8.3.js"></script>
<script src="<%=request.getContextPath()%>/public/js/jquery-ui-1.9.2.custom.min.js"></script>
</head>
<body>
<div class="container">
<c:if test="${ t eq 'todo'}">
<h2><c:out value="${model.m_title }"/></h2>
<form action='<%=request.getContextPath()%>/c?<c:out value="${ model.m_action }"/>&m_id=${model.m_id}&o=process&v=${v}&pri=${pri}&key=${key}&e_id=${e_id}' 
class='<c:out value="${ model.m_attr_class }" />'  
method="post" 
<c:out value="${ model.m_attr_other }"/> id='<c:out value="${ model.m_attr_id }"/>' <c:if test="${model.m_upload eq 1 }">enctype='multipart/form-data'</c:if>>
<fieldset>
<h4>处理</h4>
<%  Object o =request.getAttribute("e");
Map<String,Object> e = null;
if(null!=o){ e = (Map<String,Object>)o; }%>
<div class="form-line">
	<label>关联操作:</label>
	<span class="input-200">
		<a href="<%=request.getContextPath()%>/${cur_wf_check}" target="_blank">查看</a>
	</span>
</div>
<div class="cl"></div>
<c:forEach var="control" items="${controls }" >
<c:set var="attr_name" value="${control.mc_attr_name }" scope="request"/>
<% Object obj_attr_val = e!=null?e.get(request.getAttribute("attr_name").toString()):null;
request.setAttribute("attr_val", obj_attr_val);
%>
<c:if test="${control.mc_auto == 0}">
<c:if test="${control.mc_edit == 1}">
<div class="form-line">
	<label>${control.mc_prompt }:</label>
	<span class="${control.c_attr_class }">
	<c:choose>
    <c:when test="${control.c_tag eq 'textarea'}">
		<textarea name="${control.mc_attr_name }" class="txtarea">${attr_val }</textarea>
    </c:when>
    <c:when test="${control.c_tag eq 'select'}">
    <select name="${control.mc_attr_name }" class="">${control.mc_ds }</select>
    </c:when>
    <c:when test="${control.c_tag eq 'radio'}">
    	<input type="checkbox" class="toggle-radio" <c:if test="${attr_val == 1}">checked='checked'</c:if>/>
			<input type="hidden" name="${control.mc_attr_name }" value="${attr_val }"/>
    </c:when>      
    <c:otherwise>
    <input type="${control.c_tag }" name="${control.mc_attr_name }" class="field" value="${attr_val }"/>
    </c:otherwise>  
    </c:choose>
	</span>
	<span class="tip">${control.mc_tip }</span>
</div>
<div class="cl"></div>
</c:if>
</c:if>
</c:forEach>
<div class="form-line">
	<button class="save-btn">保存</button><button class="back-btn">返回</button>
</div>
<div class="cl"></div>
</fieldset>
</form>

<div class="remark-log box">
	<h4>流程备注</h4>
	<dl>
	<c:forEach var="r" items="${remarks }">
		<dt>${r.n_code}:${r.n_title }</dt>
		<dd><p>${r.n_remark }</p></dd>
	</c:forEach>
	</dl>
</div>
</c:if>


<%--  --%>
<c:if test="${ t eq 'all'}">
<form class="form">
<fieldset>
<h4>明细</h4>
<%  Object o =request.getAttribute("e");
Map<String,Object> e = null;
if(null!=o){ e = (Map<String,Object>)o; }%>
<c:forEach var="control" items="${controls }" >
<c:set var="attr_name" value="${control.mc_attr_name }" scope="request"/>
<% Object obj_attr_val = e!=null?e.get(request.getAttribute("attr_name").toString()):null;
request.setAttribute("attr_val", obj_attr_val);
%>
<c:if test="${control.mc_show == 1}">
<div class="form-line">
	<label>${control.mc_prompt }:</label>
	<span class="${control.c_attr_class }">
	<c:choose>
    <c:when test="${control.c_tag eq 'textarea'}">
		<textarea name="${control.mc_attr_name }" class="txtarea" readonly="readonly">${attr_val }</textarea>
    </c:when>
    <c:when test="${control.c_tag eq 'file'}">
    	<c:if test="${ attr_val ne null}">
    		<a href="<%=request.getContextPath()%>/dl?guid=<%= e.get("guid").toString() %>">${attr_val }</a>	
    	</c:if>
		<!-- <input type="${control.c_tag }" name="${control.mc_attr_name }" class="field" value="${attr_val }" readonly="readonly"/> -->
		
    </c:when>
    <c:when test="${control.c_tag eq 'date'}">
		<input type="text" name="${control.mc_attr_name }" class="field" value="${attr_val }" readonly="readonly"/>
    </c:when>
    <c:when test="${control.c_tag eq 'select'}">
    <select name="${control.mc_attr_name }" class="" readonly="readonly" v="${attr_val }">${control.mc_ds }</select>
    </c:when>
    <c:when test="${control.c_tag eq 'radio'}">
    	<input type="checkbox" class="toggle-radio" <c:if test="${attr_val == 1}">checked='checked'</c:if> readonly="readonly"/>
			<input type="hidden" name="${control.mc_attr_name }" value="${attr_val }"/>
    </c:when>      
    <c:otherwise>
    <input type="text" name="${control.mc_attr_name }" class="field" value="${attr_val }" readonly="readonly"/>
    </c:otherwise>  
    </c:choose>
	</span>
	<span class="tip">${control.mc_tip }</span>
</div>
<div class="cl"></div>
</c:if>
</c:forEach>
<div class="form-line">
	<button class="back-btn">关闭</button>
</div>
<div class="cl"></div>
</fieldset>
</form>
</c:if>

<%-- --%>
<c:if test="${ logs ne null}">
<div class="process-log box">
	<h4>审批日志</h4>
	<dl>
	<c:forEach var="l" items="${logs }">
		<dt>${l.ui_nickname } 予以【<c:choose>
								<c:when test="${l.p_deal_result eq 'start' }">提交</c:when>
								<c:when test="${l.p_deal_result eq 'reject' }">驳回</c:when>
								<c:when test="${l.p_deal_result eq 'stop' }">终止</c:when>
								<c:when test="${l.p_deal_result eq 'approve' }">通过</c:when>
							</c:choose>】 于 ${l.p_deal_date }</dt>
		<dd><p>意见如下：${l.p_deal_comment}</p><p>附件：<a href="<%=request.getContextPath()%>/dl?guid=${l.guid }">${l.p_attach }</a></p></dd>
	</c:forEach>
	</dl>
</div>
</c:if>
</div>
<script type="text/javascript">
$().ready(function(){
	$(".back-btn").click(function(){
		history.go(-1);
		return false;
	});	
	//$("")
	$(".form-line input[type='hidden']").each(function(){
		$(this).parents(".form-line").hide();
	});
});
</script>
</body>
</html>